package com.currency.mall.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.currency.mall.R;
import com.currency.mall.entity.CapitalOder;
import com.currency.mall.util.Util;

import java.util.List;

/**
 * Created by Administrator on 2018/12/5.
 */

public class CapitalStatusAdapter extends BaseQuickAdapter<CapitalOder, BaseViewHolder> {

    public CapitalStatusAdapter(@Nullable List<CapitalOder> data, Context context) {
        super(R.layout.item_capital_status, data);
    }

    @Override
    protected void convert(BaseViewHolder helper,CapitalOder capitalOder) {
        TextView typeName = helper.getView(R.id.tv_type_name);
        if("RECHARGE".equals(capitalOder.getType())){  //充值
            typeName.setText("充值");
        }else if("CASH".equals(capitalOder.getType())){//提现
            typeName.setText("提现");
        }else if("PURCHASE".equals(capitalOder.getType())){//认购
            typeName.setText("委托认购");
        }else if("SETTLE".equals(capitalOder.getType())){//结算
            typeName.setText("委托结算");
        }

        helper.setText(R.id.tv_price, Util.formatTosepara(Double.parseDouble(capitalOder.getOperSum())));
        helper.setText(R.id.tv_time,capitalOder.getAddTime());


    }

}
